#include "Generate_C_std.h"
#include "Pattern_assign_var.h"

class Pattern_assign_expr_array_access : public Pattern_assign_var
{
public:
	Expr* rhs_pattern()
	{
		rhs = new Wildcard<Array_access>;
		return rhs;
	}

	void generate_code (Generate_C* gen)
	{
		if (!agn->is_ref)
		{
			INST (buf, "assign_expr_array_access", 
				lhs->value, rhs->value->variable_name, rhs->value->index);
		}
		else
		{
			INST (buf, "assign_expr_ref_array_access", 
				lhs->value, rhs->value->variable_name, rhs->value->index);
		}
	}

protected:
	Wildcard<Array_access>* rhs;
};

CREATE(Pattern_assign_expr_array_access)
